home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
CFUNCTS.LZH
/
CFUNCTS.DOC
< prev
next >
Wrap
Text File
|
1987-02-03
|
2KB
|
73 lines
Greetings fellow programmer!
Here are a few useful functions that I wrote to make life a
little bit easier.
All of these functions (with the exception of rnd.c) will
run only on an IBM-PC/XT/AT (or true compatibles) running
MS-DOS 3.0 or higher.
I compiled all of these functions with Microsoft C 4.0.
-----------------------------------------------------------
card.c - This little function will do an interrupt to
to determine whether the machine it is running
on is using a CGA card or a monochrome (or Hercules)
card. This is used in the gcls.c, poke.c and peek.c
functions to determine where screen memory should
be addressed. This makes these functions portable
between machines with different graphics cards.
gcls.c - This function will clear the screen. It determines
the location of screen memory and then fills it
with blanks (0x0020) with a normal attribute (0x007).
You must either include card.c or else link with
card.obj.
usage:
gcls();
poke - This function accepts 3 arguments.
1 & 2: an x,y coordinate.
3: an ascii character code.
It is used to poke a charater at a given location with
a normal attribute.
The cooridinates start at 0,0.
It determines the beginning of screen memory and then
calculates the screen position based on the x,y cooridinate
passed. You must either include card.c or else link with
card.obj
usage:
To put a smiley face at 5,5:
poke(5,5,0);
Or to put the letter "A" at 0,0
poke(0,0,"A"); or
poke(0,0,65);
peek - This function is the opposite of poke.
You only pass the x,y coords and it returns the character at
that location. This also requires card.c or card.obj.
usage:
c = peek(x,y);
rnd - This function will generate a psuedo random number from
1 to limit.
usage:
x = rnd(limit);
------------------------------------------------------------------------
If you have any questions or comments,
please write:
Greg Bradburn
11305 Old Columbia Pike
Silver Spring, MD 20904
or call 301-593-9021.
Enjoy,
Greg.